package com.yan.design.two.establish.s2.f1;

/**
 * 1. 简单工厂
 *
 * @author shengren.yan
 * @create 2022-07-17
 */
public class FruitFactory {

    // 通过静态工厂进行创建对象
    public static Fruit getFruit(String type){
        switch (type) {
            case "苹果":
                return new Apple();
            case "橘子":
                return new Orange();
            default:
                return null;
        }
    }

}
